package com.zzw.system.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zzw.common.result.Result;
import com.zzw.model.system.SysOperLog;
import com.zzw.vo.system.SysOperLogQueryVo;
import com.zzw.system.service.AsyncOperLogService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zzw
 * @date 2023/4/26 14:38
 */
@Api(tags = "操作日志管理")
@RequestMapping("admin/system/sysOperLog")
@RestController
//用于抑制编译器产生警告信息
@SuppressWarnings({"unchecked","rawtypes"})
public class SysOperLogController {

    @Autowired
    AsyncOperLogService operLogService;
    @ApiOperation("获取分页列表")
    @GetMapping("{page}/{limit}")
    public Result list(
            @ApiParam(name = "page",value = "当前页码",required = true)
            @PathVariable Long page,
            @ApiParam(name = "limit",value = "每页记录数",required = true)
            @PathVariable Long limit,
            @ApiParam(name = "sysOperLogQueryVo",value = "查询对象",required = false)
            SysOperLogQueryVo sysOperLogQueryVo
    ){
        Page<SysOperLog> operLogPage=new Page<>(page,limit);
        IPage<SysOperLog> pageModel= operLogService.selectPage(operLogPage,sysOperLogQueryVo);
        return Result.ok(pageModel);
    }
}